package com.lg.thread.day01.security;

/**
 * 非线程安全
 * @author LG93
 * @create 2017-08-09 17:26
 **/
public class LoginServlet {

    private static String userNameRef;

    private static String passwordRef;

    synchronized public static void doPost(String userName, String password) throws InterruptedException {
        userNameRef = userName;

        if (userName.equals("a")) {
            Thread.sleep(5000);
        }

        passwordRef = password;

        System.out.println(" userName = " + userNameRef + " password = " + passwordRef);
    }
}
